#ifndef ARROWITEM_H
#define ARROWITEM_H

#include <QGraphicsLineItem>

class ArrowItem : public QGraphicsLineItem
{
public:
    enum { Type = UserType + 4 };

    //构造函数(两个item参数)
    ArrowItem(QPoint start, QPoint end, QGraphicsItem *parent = nullptr);

    //item绘制区域的估计值
    QRectF boundingRect() const override;
    //实际绘制
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)override;

    int type() const override { return Type; }

    QPainterPath shape() const override;

private:
 //   QGraphicsPolygonItem *m_pStartItem;
 //   QGraphicsPolygonItem *m_pendItem;

    QPoint ptStart;
    QPoint ptEnd;
    QPolygonF arrowHead;

};

#endif // ARROWITEM_H
